
# detect the OS
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
    set(WINDOWS 1)
else()
    message(WARNING "Unsupported operating system")
    return()
endif()

# detect the architecture
# note: this test won't work for cross-compilation
include(CheckTypeSize)
check_type_size(void* SIZEOF_VOID_PTR)
if(${SIZEOF_VOID_PTR} MATCHES "^4$")
    set(ARCH_32BITS 1)
else()
    set(ARCH_64BITS 1)
endif()

# detect the compiler and its version
if(MSVC_VERSION EQUAL 1400)
    set(COMPILER_MSVC 2005)
elseif(MSVC_VERSION EQUAL 1500)
    set(COMPILER_MSVC 2008)
elseif(MSVC_VERSION EQUAL 1600)
    set(COMPILER_MSVC 2010)
else()
    message(WARNING "Unsupported compiler")
    return()
endif()

# define the install directory for miscellaneous files
if(WINDOWS)
    set(INSTALL_MISC_DIR .)
endif()
